package com.wzh.controll;

import com.wzh.pojo.Po.Sys;
import com.wzh.pojo.result;
import com.wzh.service.SysService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/Sys")
public class SysController {
    @Autowired
	private SysService sysService;
	//读取系统配置

	@PostMapping("/read")
	@ResponseBody
	public result read() {
		Sys sys = sysService.readSys();
		String mes=sys!=null?"查询成功":"查询失败";
		Integer code=sys!=null?200:300;
		return new result(mes,code,sys);
	}



	@PostMapping("/update")
	@ResponseBody
	public result update(@RequestBody Sys sys) {
		Integer res = sysService.update(sys);
		String mes=res>0?"操作成功":"操作失败";
		Integer code=res>0?200:300;
		return new result(mes,code);
	}

}
